<?php
namespace app\common\controller;

// 自定义输出，主要输出JSON

use think\Controller;

class CustomOutput extends Controller
{
    // 直接输出结果集json
    public function outputResJson($res){
        echo json_encode($res);
        exit();
    }
    
    // 重组结果集后输出json
    public function outputJson($txt = "", $status = "", $data = array()) {
        
        $res = array();
        
        $res['txt'] = $txt;
        $res['status'] = $status;
        !empty($data) ? $res['data'] = $data : '';
        
        echo json_encode($res);
        exit();
    }
    
    
}
